/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.aptech.bluepumpkin.beans;

import com.aptech.bluepumpkin.CommentsList;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;

/**
 *
 * @author Trong Nguyen
 */
@Stateless
public class CommentsListFacade extends AbstractFacade<CommentsList> {

    @PersistenceContext(unitName = "BluePumkin-ejbPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public CommentsListFacade() {
        super(CommentsList.class);
    }

    public List<CommentsList> getAllComments() {
        String sql = "SELECT c FROM CommentsList c ORDER BY c.id";
        TypedQuery<CommentsList> createQuery = em.createQuery(sql, CommentsList.class);
        return createQuery.getResultList();
    }
}
